package domain;

import java.util.LinkedList;
import java.util.List;

import javax.swing.table.AbstractTableModel;

import serializables.Song;

public class SongTableModel extends AbstractTableModel {

	private String[] columnNames = {"Nr","Title","Artist","Length"};
	private List<Song> songs;
	
	
	
	
	public SongTableModel(List<Song> songs) {
		this.songs = songs;
	}

	@Override
	public int getColumnCount() {
		return columnNames.length;
	}

	@Override
	public int getRowCount() {
		return songs.size();
	}

	@Override
	public Object getValueAt(int row, int col) {
		switch(col){
		case 0: return 0; //id in lijst
		case 1: return songs.get(row).getTitle();
		case 2: return songs.get(row).getArtist();
		case 3: return songs.get(row).getLength();
		}
		return null;
	}

	public void setSongs(LinkedList<Song> readObject) {
		songs = readObject;
		
	}

}
